home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 60 / IOPROG_60.ISO / soft / c++ / gsl-1.1.1-setup.exe / {app} / src / cblas / test_hemv.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-18  |  10.4 KB  |  396 lines

  1. #include <gsl/gsl_test.h>
  2. #include <gsl/gsl_ieee_utils.h>
  3. #include <gsl/gsl_math.h>
  4. #include <gsl/gsl_cblas.h>
  5.  
  6. #include "tests.h"
  7.  
  8. void
  9. test_hemv (void) {
  10. const double flteps = 1e-4, dbleps = 1e-6;
  11.   {
  12.    int order = 101;
  13.    int uplo = 121;
  14.    float alpha[2] = {1.0f, 0.0f};
  15.    float beta[2] = {-0.3f, 0.1f};
  16.    int N = 1;
  17.    int lda = 1;
  18.    float A[] = { -0.434f, 0.837f };
  19.    float X[] = { 0.209f, -0.935f };
  20.    int incX = -1;
  21.    float Y[] = { 0.346f, -0.412f };
  22.    int incY = -1;
  23.    float y_expected[] = { -0.153306f, 0.56399f };
  24.    cblas_chemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  25.    {
  26.      int i;
  27.      for (i = 0; i < 1; i++) {
  28.        gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chemv(case 1070) real");
  29.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chemv(case 1070) imag");
  30.      };
  31.    };
  32.   };
  33.  
  34.  
  35.   {
  36.    int order = 101;
  37.    int uplo = 121;
  38.    float alpha[2] = {1.0f, 0.0f};
  39.    float beta[2] = {-0.3f, 0.1f};
  40.    int N = 1;
  41.    int lda = 1;
  42.    float A[] = { -0.434f, 0.837f };
  43.    float X[] = { 0.209f, -0.935f };
  44.    int incX = -1;
  45.    float Y[] = { 0.346f, -0.412f };
  46.    int incY = -1;
  47.    float y_expected[] = { -0.153306f, 0.56399f };
  48.    cblas_chemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  49.    {
  50.      int i;
  51.      for (i = 0; i < 1; i++) {
  52.        gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chemv(case 1071) real");
  53.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chemv(case 1071) imag");
  54.      };
  55.    };
  56.   };
  57.  
  58.  
  59.   {
  60.    int order = 101;
  61.    int uplo = 122;
  62.    float alpha[2] = {1.0f, 0.0f};
  63.    float beta[2] = {-0.3f, 0.1f};
  64.    int N = 1;
  65.    int lda = 1;
  66.    float A[] = { -0.434f, 0.837f };
  67.    float X[] = { 0.209f, -0.935f };
  68.    int incX = -1;
  69.    float Y[] = { 0.346f, -0.412f };
  70.    int incY = -1;
  71.    float y_expected[] = { -0.153306f, 0.56399f };
  72.    cblas_chemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  73.    {
  74.      int i;
  75.      for (i = 0; i < 1; i++) {
  76.        gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chemv(case 1072) real");
  77.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chemv(case 1072) imag");
  78.      };
  79.    };
  80.   };
  81.  
  82.  
  83.   {
  84.    int order = 101;
  85.    int uplo = 122;
  86.    float alpha[2] = {1.0f, 0.0f};
  87.    float beta[2] = {-0.3f, 0.1f};
  88.    int N = 1;
  89.    int lda = 1;
  90.    float A[] = { -0.434f, 0.837f };
  91.    float X[] = { 0.209f, -0.935f };
  92.    int incX = -1;
  93.    float Y[] = { 0.346f, -0.412f };
  94.    int incY = -1;
  95.    float y_expected[] = { -0.153306f, 0.56399f };
  96.    cblas_chemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  97.    {
  98.      int i;
  99.      for (i = 0; i < 1; i++) {
  100.        gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chemv(case 1073) real");
  101.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chemv(case 1073) imag");
  102.      };
  103.    };
  104.   };
  105.  
  106.  
  107.   {
  108.    int order = 102;
  109.    int uplo = 121;
  110.    float alpha[2] = {1.0f, 0.0f};
  111.    float beta[2] = {-0.3f, 0.1f};
  112.    int N = 1;
  113.    int lda = 1;
  114.    float A[] = { -0.434f, 0.837f };
  115.    float X[] = { 0.209f, -0.935f };
  116.    int incX = -1;
  117.    float Y[] = { 0.346f, -0.412f };
  118.    int incY = -1;
  119.    float y_expected[] = { -0.153306f, 0.56399f };
  120.    cblas_chemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  121.    {
  122.      int i;
  123.      for (i = 0; i < 1; i++) {
  124.        gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chemv(case 1074) real");
  125.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chemv(case 1074) imag");
  126.      };
  127.    };
  128.   };
  129.  
  130.  
  131.   {
  132.    int order = 102;
  133.    int uplo = 121;
  134.    float alpha[2] = {1.0f, 0.0f};
  135.    float beta[2] = {-0.3f, 0.1f};
  136.    int N = 1;
  137.    int lda = 1;
  138.    float A[] = { -0.434f, 0.837f };
  139.    float X[] = { 0.209f, -0.935f };
  140.    int incX = -1;
  141.    float Y[] = { 0.346f, -0.412f };
  142.    int incY = -1;
  143.    float y_expected[] = { -0.153306f, 0.56399f };
  144.    cblas_chemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  145.    {
  146.      int i;
  147.      for (i = 0; i < 1; i++) {
  148.        gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chemv(case 1075) real");
  149.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chemv(case 1075) imag");
  150.      };
  151.    };
  152.   };
  153.  
  154.  
  155.   {
  156.    int order = 102;
  157.    int uplo = 122;
  158.    float alpha[2] = {1.0f, 0.0f};
  159.    float beta[2] = {-0.3f, 0.1f};
  160.    int N = 1;
  161.    int lda = 1;
  162.    float A[] = { -0.434f, 0.837f };
  163.    float X[] = { 0.209f, -0.935f };
  164.    int incX = -1;
  165.    float Y[] = { 0.346f, -0.412f };
  166.    int incY = -1;
  167.    float y_expected[] = { -0.153306f, 0.56399f };
  168.    cblas_chemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  169.    {
  170.      int i;
  171.      for (i = 0; i < 1; i++) {
  172.        gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chemv(case 1076) real");
  173.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chemv(case 1076) imag");
  174.      };
  175.    };
  176.   };
  177.  
  178.  
  179.   {
  180.    int order = 102;
  181.    int uplo = 122;
  182.    float alpha[2] = {1.0f, 0.0f};
  183.    float beta[2] = {-0.3f, 0.1f};
  184.    int N = 1;
  185.    int lda = 1;
  186.    float A[] = { -0.434f, 0.837f };
  187.    float X[] = { 0.209f, -0.935f };
  188.    int incX = -1;
  189.    float Y[] = { 0.346f, -0.412f };
  190.    int incY = -1;
  191.    float y_expected[] = { -0.153306f, 0.56399f };
  192.    cblas_chemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  193.    {
  194.      int i;
  195.      for (i = 0; i < 1; i++) {
  196.        gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chemv(case 1077) real");
  197.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chemv(case 1077) imag");
  198.      };
  199.    };
  200.   };
  201.  
  202.  
  203.   {
  204.    int order = 101;
  205.    int uplo = 121;
  206.    double alpha[2] = {0, 0};
  207.    double beta[2] = {1, 0};
  208.    int N = 1;
  209.    int lda = 1;
  210.    double A[] = { 0.036, -0.966 };
  211.    double X[] = { -0.695, 0.886 };
  212.    int incX = -1;
  213.    double Y[] = { 0.486, 0.629 };
  214.    int incY = -1;
  215.    double y_expected[] = { 0.486, 0.629 };
  216.    cblas_zhemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  217.    {
  218.      int i;
  219.      for (i = 0; i < 1; i++) {
  220.        gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhemv(case 1078) real");
  221.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhemv(case 1078) imag");
  222.      };
  223.    };
  224.   };
  225.  
  226.  
  227.   {
  228.    int order = 101;
  229.    int uplo = 121;
  230.    double alpha[2] = {0, 0};
  231.    double beta[2] = {1, 0};
  232.    int N = 1;
  233.    int lda = 1;
  234.    double A[] = { 0.036, -0.966 };
  235.    double X[] = { -0.695, 0.886 };
  236.    int incX = -1;
  237.    double Y[] = { 0.486, 0.629 };
  238.    int incY = -1;
  239.    double y_expected[] = { 0.486, 0.629 };
  240.    cblas_zhemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  241.    {
  242.      int i;
  243.      for (i = 0; i < 1; i++) {
  244.        gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhemv(case 1079) real");
  245.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhemv(case 1079) imag");
  246.      };
  247.    };
  248.   };
  249.  
  250.  
  251.   {
  252.    int order = 101;
  253.    int uplo = 122;
  254.    double alpha[2] = {0, 0};
  255.    double beta[2] = {1, 0};
  256.    int N = 1;
  257.    int lda = 1;
  258.    double A[] = { 0.036, -0.966 };
  259.    double X[] = { -0.695, 0.886 };
  260.    int incX = -1;
  261.    double Y[] = { 0.486, 0.629 };
  262.    int incY = -1;
  263.    double y_expected[] = { 0.486, 0.629 };
  264.    cblas_zhemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  265.    {
  266.      int i;
  267.      for (i = 0; i < 1; i++) {
  268.        gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhemv(case 1080) real");
  269.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhemv(case 1080) imag");
  270.      };
  271.    };
  272.   };
  273.  
  274.  
  275.   {
  276.    int order = 101;
  277.    int uplo = 122;
  278.    double alpha[2] = {0, 0};
  279.    double beta[2] = {1, 0};
  280.    int N = 1;
  281.    int lda = 1;
  282.    double A[] = { 0.036, -0.966 };
  283.    double X[] = { -0.695, 0.886 };
  284.    int incX = -1;
  285.    double Y[] = { 0.486, 0.629 };
  286.    int incY = -1;
  287.    double y_expected[] = { 0.486, 0.629 };
  288.    cblas_zhemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  289.    {
  290.      int i;
  291.      for (i = 0; i < 1; i++) {
  292.        gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhemv(case 1081) real");
  293.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhemv(case 1081) imag");
  294.      };
  295.    };
  296.   };
  297.  
  298.  
  299.   {
  300.    int order = 102;
  301.    int uplo = 121;
  302.    double alpha[2] = {0, 0};
  303.    double beta[2] = {1, 0};
  304.    int N = 1;
  305.    int lda = 1;
  306.    double A[] = { 0.036, -0.966 };
  307.    double X[] = { -0.695, 0.886 };
  308.    int incX = -1;
  309.    double Y[] = { 0.486, 0.629 };
  310.    int incY = -1;
  311.    double y_expected[] = { 0.486, 0.629 };
  312.    cblas_zhemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  313.    {
  314.      int i;
  315.      for (i = 0; i < 1; i++) {
  316.        gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhemv(case 1082) real");
  317.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhemv(case 1082) imag");
  318.      };
  319.    };
  320.   };
  321.  
  322.  
  323.   {
  324.    int order = 102;
  325.    int uplo = 121;
  326.    double alpha[2] = {0, 0};
  327.    double beta[2] = {1, 0};
  328.    int N = 1;
  329.    int lda = 1;
  330.    double A[] = { 0.036, -0.966 };
  331.    double X[] = { -0.695, 0.886 };
  332.    int incX = -1;
  333.    double Y[] = { 0.486, 0.629 };
  334.    int incY = -1;
  335.    double y_expected[] = { 0.486, 0.629 };
  336.    cblas_zhemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  337.    {
  338.      int i;
  339.      for (i = 0; i < 1; i++) {
  340.        gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhemv(case 1083) real");
  341.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhemv(case 1083) imag");
  342.      };
  343.    };
  344.   };
  345.  
  346.  
  347.   {
  348.    int order = 102;
  349.    int uplo = 122;
  350.    double alpha[2] = {0, 0};
  351.    double beta[2] = {1, 0};
  352.    int N = 1;
  353.    int lda = 1;
  354.    double A[] = { 0.036, -0.966 };
  355.    double X[] = { -0.695, 0.886 };
  356.    int incX = -1;
  357.    double Y[] = { 0.486, 0.629 };
  358.    int incY = -1;
  359.    double y_expected[] = { 0.486, 0.629 };
  360.    cblas_zhemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  361.    {
  362.      int i;
  363.      for (i = 0; i < 1; i++) {
  364.        gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhemv(case 1084) real");
  365.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhemv(case 1084) imag");
  366.      };
  367.    };
  368.   };
  369.  
  370.  
  371.   {
  372.    int order = 102;
  373.    int uplo = 122;
  374.    double alpha[2] = {0, 0};
  375.    double beta[2] = {1, 0};
  376.    int N = 1;
  377.    int lda = 1;
  378.    double A[] = { 0.036, -0.966 };
  379.    double X[] = { -0.695, 0.886 };
  380.    int incX = -1;
  381.    double Y[] = { 0.486, 0.629 };
  382.    int incY = -1;
  383.    double y_expected[] = { 0.486, 0.629 };
  384.    cblas_zhemv(order, uplo, N, alpha, A, lda, X, incX, beta, Y, incY);
  385.    {
  386.      int i;
  387.      for (i = 0; i < 1; i++) {
  388.        gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhemv(case 1085) real");
  389.        gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhemv(case 1085) imag");
  390.      };
  391.    };
  392.   };
  393.  
  394.  
  395. }
  396.